package com.yonyou.pmclouds.plantemplate.entity;


import com.yonyou.pmclouds.basecom.entity.SuperVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "pm_schedule_template_item")
public class ScheduleTemplateItemVO extends SuperVO {

    public static final String MANAGER = "manager";

    public static final String MANAGER_NAME = "managerName";

    public static String CREATOR = "creator";

    public static String CREATOR_NAME = "creatorName";

    public static String CODE = "code";

    public static final String[] UPDATE_FIELDS = {"name", "code", "dependPlan", "planDays", "description", "manager", "pkMilestone", "relatedBillType",
            "pkDepartment", "relatedPkBill", "modifier", "modifytime", "changeFlag"};

    @Id
    @NotNull(groups = UpdateValid.class)
    private String pkScheduleTemplateItem;

    private String pkScheduleTemplate;

    @Size(max = 50)
    @NotNull
    private String name;

    private String code;

    private int seq;

    private String dependPlan;

    private String manager;

    @NotNull
    private Integer planDays;

    @Size(max = 300)
    private String description;

    private String pkRoot;

    private String pkParent;

    private Integer childCount;

    private String creator;

    private Date creationtime;

    private String modifier;

    private Date modifytime;

    private String pkMilestone;

    private String relatedBillType;

    private String pkDepartment;

    private String relatedPkBill;

    @Transient
    private ScheduleTemplateItemVO[] children;

    // 前端表格组件使用，存在主键值，唯一
    @Transient
    private String key;

    @Transient
    private String dependPlanName;

    // 前置计划对象，甘特图取值使用
    @Transient
    private ScheduleTemplateItemVO[] dependPlans;

    @Transient
    private String managerName;

    @Transient
    private String departmentName;

    /**
     * 里程碑编码、名称
     */
    @Transient
    private String milestoneCode;
    @Transient
    private String milestoneName;
    /**
     * 关联单据类型名称
     */
    @Transient
    private String relatedBillTypeName;

    public interface UpdateValid {
    }

    public interface InsertValid {
    }
}
